Masala #0997
Noldan farqli raqamlar
Barcha noldan farqli raqamlar o'sish tartibida (123456789) berilgan ularning orasiga \(+,-\) amallarini qo'yib yoki qo'ymasdan \(N\) sonini hosil qilish mumkin bo'lgan permutatsiyalarni chop eting
Kirish faylining yagona satrida \(N\) soni \((-100 \le N \le 125)\)
Barcha permutatsiyalar sonini va ularni leksikografik kamayish tartibida chop eting
# | input.txt | output.txt |
---|---|---|
1 |
45 |
26 1+2+3+4+5+6+7+8+9=45 1+2+3-45+67+8+9=45 1+2-3+45+6-7-8+9=45 1+2-3+45-6+7+8-9=45 1+2-3-45-6+7+89=45 1+2-34-5-6+78+9=45 1+23+4+5+6+7+8-9=45 1+23+4-5-67+89=45 1+23-4-5+6+7+8+9=45 1+23-45+67+8-9=45 1-2+3+45+6-7+8-9=45 1-2+3-45+6-7+89=45 1-2-3+4-5+67-8-9=45 1-2-3+45-6-7+8+9=45 1-2-34+5+6+78-9=45 1-2-34+56+7+8+9=45 1-23+4-5+67-8+9=45 1-23+45-67+89=45 1-23-4+5+67+8-9=45 1-23-4-5-6-7+89=45 12+3+4-56-7+89=45 12+3-45+6+78-9=45 12+34-5-6-7+8+9=45 12-3+4+56-7-8-9=45 12-3-4-56+7+89=45 12-3-45-6+78+9=45 |
Raqamlardan faqat bir martadan foydalaning